<?php
    include('incs/database.inc.php');
	include('incs/config.inc.php');
	include('incs/function.inc.php');
	db_open();
    $data = $_POST["data"];
    $bulan = $_POST["bulan"];
    $tahun = $_POST["tahun"];
	$jumlah = $_POST["jumlah"];

	for ($row = 0; $row < $jumlah; $row++)
	{
		$loop=0;
        foreach ($data[$row] as $key => $value)
		{
			$aa[$loop]=$value;
			$loop++;
		}
        if(1)
            //echo $aa[0]."-".$aa[1]."-".$aa[2]."-".$aa[3]."-".$aa[4]."-".$aa[5]."-".$aa[6]."-".$aa[7]."-".$aa[8]."-".$aa[9]."-".$aa[10]."-".$aa[11]."-".$aa[12]."-".$aa[13]."-".$aa[14]."<br />";
            $query_update = "UPDATE `l04` SET `RUSAK_JARINGAN`=$aa[1], `RUSAK_WORK_STATION`=$aa[2], `RUSAK_ID_PRINTER`=$aa[3], `RUSAK_PHOTO_CAPTURE`=$aa[4], `RUSAK_SIGN_CAPTURE`=$aa[5], `RUSAK_FINGER_CAPTURE`=$aa[6], `RUSAK_DOT_PRINTER`=$aa[7], `RUSAK_UPS`=$aa[8], `RUSAK_SERVER`=$aa[9], `KETERANGAN`='$aa[10]' WHERE `ID_SATPAS`='$aa[0]' AND `TAHUN`='$tahun' AND `BULAN`='$bulan'";
            //echo $query_update;$data['RUSAK_JARINGAN']+$data['RUSAK_WORK_STATION']+$data['RUSAK_ID_PRINTER']+$data['RUSAK_PHOTO_CAPTURE']+$data['RUSAK_SIGN_CAPTURE']+$data['RUSAK_FINGER_CAPTURE']+$data['RUSAK_DOT_PRINTER']+$data['RUSAK_UPS']+$data['RUSAK_SERVER']
            $query = db_query($query_update);

		   //	echo $aa[0]."-".$aa[1]."-".$aa[2]."-".$aa[3]."-".$aa[4]."-".$aa[5]."-".$total."-".$huruf;
          //  exit();
		}

    $query_s = "SELECT *
				FROM `view_l04` WHERE `bulan`=$bulan AND `tahun`=$tahun";
	$hasil = db_query($query_s);
    while($tampil_data = db_fetch_array($hasil)){
		$arrdata[] = $tampil_data;
	}

    $query_b = "SELECT `DESKRIPSI` FROM `bulan` WHERE `ID`=$bulan LIMIT 1";
	$hasil_b = db_query($query_b);
	$bulannya = db_fetch_array($hasil_b);
?>
<div align="left" style="font-family: verdana;font-size: 12">
    <div align="center">Bulan : <?php echo $bulannya['DESKRIPSI']." ".$tahun;?></div><br />
    <form name="table_cari" action="./lihat_data_4.php">
   <table align="center" border="1" width="1024" cellpadding="5" cellspacing="0" style="font-family: Verdana;font-size: 12">
		   <tr align="center">
                <th width="30" height="43" rowspan="2">NO.</th>
                <th width="200" rowspan="2" rowspan="3">POLDA / SATPAS</th>
                <th width="320" colspan="9">JENIS KERUSAKAN / HAMBATAN</th>
                <th width="40" rowspan="2">JUMLAH</th>
                <th width="40" rowspan="2">KETERANGAN</th>
            </tr>
            <tr>
                <th width="40">JARINGAN</th>
                <th width="40">WORK STATION</th>
    			<th width="40">ID CARD PRINTER</th>
    			<th width="40">PHOTO CAPTURE</th>
    			<th width="40">SIGN CAPTURE</th>
                <th width="40">FINGER PRINT CAPTURE</th>
                <th width="40">DOT MATRIK PRINTER</th>
  			    <th width="40">UPS</th>
  			    <th width="40">SERVER</th>
            </tr>
            <?php $seq_number=1;?>
            <?php foreach($arrdata AS $data) { ?>
            <tr>
                <td><?php echo $seq_number;?></td>
                <td><?php echo $data['NAMA_SATPAS'];?></td>
                <td><?php echo $data['RUSAK_JARINGAN'];?></td>
                <td><?php echo $data['RUSAK_WORK_STATION'];?></td>
                <td><?php echo $data['RUSAK_ID_PRINTER'];?></td>
                <td><?php echo $data['RUSAK_PHOTO_CAPTURE'];?></td>
                <td><?php echo $data['RUSAK_SIGN_CAPTURE'];?></td>
                <td><?php echo $data['RUSAK_FINGER_CAPTURE'];?></td>
                <td><?php echo $data['RUSAK_DOT_PRINTER'];?></td>
                <td><?php echo $data['RUSAK_UPS'];?></td>
                <td><?php echo $data['RUSAK_SERVER'];?></td>
                <td align="center"><?php echo $jml=$data['RUSAK_JARINGAN']+$data['RUSAK_WORK_STATION']+$data['RUSAK_ID_PRINTER']+$data['RUSAK_PHOTO_CAPTURE']+$data['RUSAK_SIGN_CAPTURE']+$data['RUSAK_FINGER_CAPTURE']+$data['RUSAK_DOT_PRINTER']+$data['RUSAK_UPS']+$data['RUSAK_SERVER'];?></td>
                <td><?php echo $data['KETERANGAN'];?>&nbsp;</td>
            </tr>
            <?php $seq_number++;?>
            <?php } ?>

     </table>
     <input type="hidden" name="bulan" value="<?php echo $bulan?>">
     <input type="hidden" name="tahun" value="<?php echo $tahun?>">
     <br />
     <div align="center">
        <button title="Klik untuk edit" name="Submit" type="submit" value="Edit">Edit</button>&nbsp;
        <button title="Klik untuk kembali" type="button" onclick="self.location='./index4.php'"  value="Kembali">&laquo; Kembali</button>
        <button title="Klik untuk mencetak" type="button" onclick="self.location='javascript:print()'"  value="Print">Print</button>
     </div>
  </form>
</div>

<br />
